package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 新增套餐菜品关联表数据
     * @param setmealDishes
     */
    @AutoFill(value = OperationType.INSERT)
    void insert(List<SetmealDish> setmealDishes);

    /**
     * 根据id查询
     *
     * @param ids
     * @return
     */
    List<Long> selectByDishIds(List<Long> ids);

    /**
     * 删除
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id =#{setmealId}")
    void delete(Long setmealId);

    /**
     * 根据套餐id查询关联表中的数据
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> selectBySetmealId(Long id);

    /**
     * 菜品表修改,关联表共同字段修改
     *
     */

    void updateWithDish(DishDTO dishDTO);


}
